notebook: Compute tab width in a simpler way
authorBenjamin Otte <otte@redhat.com>
Wed, 1 Jun 2011 19:56:13 +0000 (21:56 +0200)
committerBenjamin Otte <otte@redhat.com>
Wed, 1 Jun 2011 19:57:45 +0000 (21:57 +0200)
This code should be more obvious: The check only needs to check for
scrollable widgets, and only needs to compare to tab_width.

As a side note, for vis_pages == 1, tab_width will be smaller than
tab_max + stuff, so this code will not behave differently.

gtk/gtknotebook.c

index 1aabc6a69f639e6c6e126e702820640e03c0c9c0..bab4e073233e756665859f673d5091367ecff1fc 100644 (file)
@@ -2136,9 +2136,9 @@ gtk_notebook_size_request (GtkWidget      *widget,
                       page->requisition.height = tab_height;
                     }
 
-                  if (priv->scrollable && vis_pages > 1 &&
-                      requisition->width < tab_width)
-                    tab_width = tab_max + 2 * (scroll_arrow_hlength + arrow_spacing);
+                  if (priv->scrollable)
+                    tab_width = MIN (tab_width,
+                                     tab_max + 2 * (scroll_arrow_hlength + arrow_spacing));
 
                   action_width += action_widget_requisition[ACTION_WIDGET_START].width;
                   action_width += action_widget_requisition[ACTION_WIDGET_END].width;
@@ -2184,9 +2184,9 @@ gtk_notebook_size_request (GtkWidget      *widget,
                       tab_height += page->requisition.height;
                     }
 
-                  if (priv->scrollable && vis_pages > 1 &&
-                      requisition->height < tab_height)
-                    tab_height = tab_max + (2 * scroll_arrow_vlength + arrow_spacing);
+                  if (priv->scrollable)
+                    tab_height = MIN (tab_height,
+                                      tab_max + (2 * scroll_arrow_vlength + arrow_spacing));
                   action_height += action_widget_requisition[ACTION_WIDGET_START].height;
                   action_height += action_widget_requisition[ACTION_WIDGET_END].height;